package kodkod.analysis.visitor;

import java.util.HashMap;
import kodkod.ast.*;

public class IncomingPaths extends AbstractAnalyzer {
	
	public HashMap<LeafExpression, Integer> counter = new HashMap<LeafExpression, Integer>();
	
	protected IncomingPaths() {}

	public IncomingPaths(Formula formula) {
		this.visit(formula);
	}
		
	@Override
	protected boolean visited(Node n) {
		return false;
	}
	
	@Override
	public void foundLeafExpression(LeafExpression leaf) {
		Integer count = counter.get(leaf);
		if (count == null) {
			counter.put(leaf, 1);
		} else {
			counter.put(leaf, count+1);
		}
	}

	@Override
	void beginChild(Node parent, Node child) {}
	
	@Override
	void endChild(Node parent, Node child) {}
}